package com.pipayshop.config;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

@Configuration
public class MessageSourceConfig {

    @Bean
    public MessageSource messageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        // 设置翻译文件的路径
        messageSource.setBasename("classpath:lang/lang");
        // 设置字符集
        messageSource.setDefaultEncoding("UTF-8");
        return messageSource;
    }
}
